package org.projetjava.presentation;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JLabel;

import org.projetjava.metier.model.HyperText;

public class SuppressionHypertext extends MouseAdapter{
	
	private CreationDescription creationDescription = null;

	private JLabel hyperText = null;
	private HyperText ht = null;
	private CreationDescriptionPoi creationDescriptionPoi = null;
	private CreationDescriptionLieu creationDescriptionLieu = null;
	
	public SuppressionHypertext(CreationDescription creationDescription, JLabel hyperText, HyperText ht )
	{
		this.creationDescription = creationDescription;

		this.hyperText = hyperText;
		this.ht = ht;
	}
	
	public SuppressionHypertext(CreationDescriptionPoi creationDescriptionPoi, JLabel hyperText, HyperText ht )
	{
		this.creationDescriptionPoi = creationDescriptionPoi;

		this.hyperText = hyperText;
		this.ht = ht;
	}
	
	public SuppressionHypertext(CreationDescriptionLieu creationDescriptionLieu, JLabel hyperText, HyperText ht )
	{
		this.creationDescriptionLieu = creationDescriptionLieu;

		this.hyperText = hyperText;
		this.ht = ht;
	}
	
	
	public void mouseClicked(MouseEvent e)
	{
		if(creationDescriptionPoi == null && creationDescriptionLieu == null)
		{
			creationDescription.getListeLiens().remove(hyperText);
			creationDescription.getLienHyperText().remove(ht);
			creationDescription.getListeLiens().repaint();

		}else if(creationDescription == null && creationDescriptionLieu == null)
		{
			creationDescriptionPoi.getListeLiens().remove(hyperText);
			creationDescriptionPoi.getLienHyperText().remove(ht);
			creationDescriptionPoi.getListeLiens().repaint();

		}else
		{
			creationDescriptionLieu.getListeLiens().remove(hyperText);
			creationDescriptionLieu.getLienHyperText().remove(ht);
			creationDescriptionLieu.getListeLiens().repaint();
		}
		
		
	}

}
